package beans;

import java.util.ArrayList;
import java.util.List;

public class RolesBean {
	private List<RoleItemBean> roleItemsList;
	
	public RolesBean() {
		roleItemsList = new ArrayList<RoleItemBean>();
	}
	
	public void addRow(RoleItemBean roleItemBean) {
		roleItemsList.add(roleItemBean);
	}
	
	public String getJson() {
		StringBuffer sb = new StringBuffer();

		sb.append("{ ");
		sb.append("\"row\": [");
		for (int i = 0; i < roleItemsList.size(); i++) {
			
			RoleItemBean roleItemBean = roleItemsList.get(i);
			sb.append(roleItemBean.getJson());
			
			if (i != roleItemsList.size() - 1) {
				sb.append(",");
			}
		}
		sb.append("]");
		sb.append("}");
					
		return sb.toString();
	}
}
